package cn.lili.modules.permission.entity.dto;

import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.modules.permission.entity.dos.Department;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;


/**
 * 部门
 *
 * @author Chopper
 * @since 2020/11/19 11:57
 */
@Data
public class DepartmentSearchParams {

    @ApiModelProperty(value = "部门名称")
    private String title;

    @ApiModelProperty(value = "父id")
    private String parentId;

    private String scene;

    private String storeId;

    public QueryWrapper<Department> wrapper() {
        QueryWrapper<Department> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(CharSequenceUtil.isNotEmpty(parentId), "parent_id", this.parentId);
        queryWrapper.like(CharSequenceUtil.isNotEmpty(title), "title", this.title);
        return queryWrapper;
    }

}